﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System.Collections.Generic
{
    public class ObservableStack<T> : ObservableCollection<T>, IEnumerable<T>
    {
        public virtual T Peek()
        {
            return this.Last();
        }

        public virtual T Pop()
        {
            var item = this.Last();
            this.Remove(item);
            return item;
        }

        public virtual void Push(T item)
        {
            base.Add(item);
        }

        IEnumerator<T> IEnumerable<T>.GetEnumerator()
        {
            return new Stack<T>.Enumerator();
        }
    }
}
